package com.easylinkin.linkappapi.deviceservice.mapper;

import com.easylinkin.linkappapi.deviceservice.entity.DeviceServiceTenantConfig;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
import java.util.Set;
import org.apache.ibatis.annotations.Param;

/**
 * <p>
 * 设备服务租户个性化配置 Mapper 接口
 * </p>
 *
 * @author TongJie
 * @since 2020-10-28
 */
public interface DeviceServiceTenantConfigMapper extends BaseMapper<DeviceServiceTenantConfig> {

    List<DeviceServiceTenantConfig> getDeviceServiceTenantConfigs(@Param("deviceServiceTenantConfig") DeviceServiceTenantConfig deviceServiceTenantConfig);

    /**
     * 对新增的设备服务，查询旧版的设备服务是否有个性化配置 如果有修改，用新增的设备服务id 替换
     *
     * @param addDeviceServicesIds 新增的设备服务id集合
     */
    void inheritPersonalizedConfig(@Param("addDeviceServicesIds") Set<String> addDeviceServicesIds);

    /**
     * 清理重复数据，时间旧的数据都去掉，只保留一条
     */
    void deleteServiceIdentifierRepeatData();

    List<DeviceServiceTenantConfig> getNeedAddConfigAfterInheritPersonalizedConfig();

    List<DeviceServiceTenantConfig> getLatestToBeUpdatedPersonalizedConfig(@Param("addDeviceServicesIds") Set<String> addDeviceServicesIds);

}
